﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace PeisongWeb.admin
{
    public partial class reportCustomer : adminPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (hasPermission("DD", 1))
                {
                    txtRbno.Text = System.DateTime.Now.AddDays(-1).ToString("yyyyMMdd") + "01";
                    rptBind(txtRbno.Text);
                }
                else
                {
                    Library.Script.ClientMsgUrl("没有权限！", "index.aspx");
                    return;
                }
                
            }
        }

        private void rptBind(string rbno)
        {
            DataTable dt = DAL.DbHelper.ExecuteDataTable("p_report_customer_listByRb", rbno,txtCompany.Text);
            rpt_list.DataSource = dt;
            rpt_list.DataBind();
            if (dt.Rows.Count == 0)
                tr_none.Visible = true;
            else
                tr_none.Visible = false;
        }

        protected void bt_query_Click(object sender, EventArgs e)
        {
            string rbno = txtRbno.Text.Trim();
            if (Library.Number.IsInt(rbno))
            {
                rptBind(rbno);
            }
            else
            {
                Library.Script.ClientMsg("错误的提货单号，请重新输入；");
            }
        }
       
    }
}
